package com.stu.covid.business.utils;

import java.util.List;
//获取结果集工具类

public class ResultFactory {

    public static <T> Result bulid(CodeMsg codeMsg, Integer count, List<T> data) {
        Result<T> result = new Result<T>(codeMsg.code, codeMsg.msg, count, data);
        return result;
    }

    public static <T> Result bulid(CodeMsg codeMsg, T obj) {
        Result<T> result = new Result<T>(codeMsg.code, codeMsg.msg, obj);
        return result;
    }

    public static <T> Result bulid(CodeMsg codeMsg) {
        Result<T> result = new Result<T>(codeMsg.code, codeMsg.msg);
        return result;
    }

    public static <T> Result success() {
        Result<T> result = new Result<T>(CodeMsg.SUCCESS.code, CodeMsg.SUCCESS.msg);
        return result;
    }

    public static <T> Result error() {
        Result<T> result = new Result<T>(CodeMsg.ERROR.code, CodeMsg.ERROR.msg);
        return result;
    }
}
